import createDOM from "./createDOM";
export default function mountNativeElement(virtualDOM, container, oldDOM) {
    let newElement = createDOM(virtualDOM)
    if (oldDOM) {
        container.insertBefore(newElement, oldDOM)
    } else {
        container.appendChild(newElement)
    }
    if (oldDOM) oldDOM.remove()

    let component = virtualDOM.component
    if (component) {
        component.setDOM(newElement)
    }
}